//
//  OPZJNewCarSection.m
//  NewWorld
//
//  Created by 曾静 on 16/4/28.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "OPZJNewCarSection.h"
@interface OPZJNewCarSection()
@property (nonatomic,weak) UILabel *onLable;
@end
@implementation OPZJNewCarSection


/**
 *  实例化的方法
 */
+(instancetype)headerViewWithTableView:(UITableView *)tableView{
    
    //1. 定义重用的标识
    NSString *reuseId = @"new";
    //2. 根据重用的标识获取重用的headerView
    OPZJNewCarSection *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:reuseId];
    
    //3. 判断是否存在
    if (!headerView) {
        headerView = [[self alloc]initWithReuseIdentifier:reuseId];
        headerView.contentView.backgroundColor = [OPColorWithHex colorWithHexString:@"5ca6e9"];
    }
    
    //4. 返回对象
    return headerView;
    
}



- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
      //显示图标数据
        UILabel *onLabel = [[UILabel alloc]init];
        self.onLable = onLabel;
        self.onLable.font = [UIFont systemFontOfSize:13];
        self.onLable.textColor  = [UIColor whiteColor];
        [self addSubview:onLabel];
        

        
        
    }
    return self;
    
    
}

-(void)setTitle:(NSString *)title{
    _title = title;
    //设置UILable的数量
    self.onLable.text = [NSString stringWithFormat:@"%@",self.title];
    
    
    //     UIScreen *screen = [UIScreen mainScreen];
    
    self.onLable.frame = CGRectMake(12, 0, 100, 30);
}







@end
